import useOverlay from "./useOverlay";

const useWinRes = defineStore("winRes", () => {
  const showWinRes = ref(false);
  const resData = ref<any>({});
  const style = reactive({
    "--van-overlay-z-index": 1,
    "--van-overlay-background": "rgba(0, 0, 0, 0.7)"
  });
  function toggleWinRes(res?: any) {
    // console.log(res);
    if (res) {
      resData.value = res;
    }
    showWinRes.value = !showWinRes.value;
    const { toggleShowWinRes } = useOverlay();
    toggleShowWinRes(showWinRes.value);
  }
  return { style, showWinRes, toggleWinRes, resData };
});

export const useWinResRefs = () => {
  return storeToRefs(useWinRes());
};
export default useWinRes;
